#!/bin/bash

#part1
# echo --------part1---------
# abc=Value_of_abc
# echo $abc
# echo ${abc}
# echo "$abc"
# echo "${abc}"
# echo '$abc'

# #part2
# echo --------part2---------
# foo=
# if [ -z "$foo" ]; then
# 	echo "foo is null"
# fi

# let "foo +=5"
# echo $foo

# #part3
# echo --------part3---------
# a1=33
# let b1=a1+1
# echo $b1

#part4
# echo --------part4---------
# echo "enter num value"
# read num
# echo "num=$num"

# #part5
# echo --------part5---------
# a2=`echo Hello`
# echo $a2
# a2=`ls -l`
# echo $a2
# echo 
# echo "$a2"
# # "$a2" auto newline 


# #part6
# echo --------part6---------
# # reg
# a=2345
# b=${a/23/xx}
# echo $b
# let "b += 1" # set a string to 0
# echo "b=$b"

# e= # or e='' or e=""  null value
# let "e += 1"
# echo "e=$e"

# let "f += 1" #undeclared var
# echo "f=$f"

# let "f /=$undeclared"
# let "f /= 0"

# (a=1) # local
# echo $a #2345
# {
# 	a=1
# }
# echo $a #1


# #part7 position arguments
# # test ./xx.sh a1 a2 a3 a4
# echo --------part7---------
# echo $* # all args from $1 -->
# echo $@ # same as $*
# echo "arg len=$#" # arg length from $1
# if [ $# -lt 10 ]; then
# 	echo "arguments length less then 10"
# fi

# #last arg
# args=$#
# lastarg=${!#} #or lastarg=${!args}
# echo "last arg = $lastarg"


#part8 position arguments
echo --------part8---------
var1_=$1_ # rather than var1=$1
# will prevent an err, even if position para is absent
echo $var1_

critical_arg1=$var1_
var1=${var1_/_/}
# if [ -z $1 ]; then
# 	echo "null arg1"
# 	exit 1
# fi
echo var1